package fitness;

import org.jgap.FitnessFunction;
import org.jgap.IChromosome;

import character.Hunter;

public class HunterFitness extends FitnessFunction {

	/**
	 * 
	 */
	private static final long serialVersionUID = -4763014173348797809L;

	@Override
	protected double evaluate(IChromosome profile) {
		Integer strength = (Integer) profile.getGene(0).getAllele();
		Integer agility =  (Integer) profile.getGene(1).getAllele();
		Integer stamina =  (Integer) profile.getGene(2).getAllele();
		Integer intellect =  (Integer) profile.getGene(3).getAllele();
		Integer spirit =  (Integer) profile.getGene(4).getAllele();
		
		Hunter hunter = new Hunter();
		hunter.setStrength(strength);
		hunter.setAgility(agility);
		hunter.setStamina(stamina);
		hunter.setIntellect(intellect);
		hunter.setSpirit(spirit);
		
		double res = 10.163  * hunter.getAttackPower() +
					 10.163  * hunter.getArmor() + 
					 20.325  * hunter.getSpeed() +
					 8.130  * hunter.getResilience() + 
					 16.260  * hunter.getDodgeRating() + 
					 1.016  * hunter.getMana() +
					 1.423 * hunter.getHealth() +
					 4.065  * hunter.getSpellPenetration() +
					 14.228  * hunter.getHaste() + 
					 10.163  * hunter.getHealthRegeneration() +
					 4.065  * hunter.getManaRegeneration();
		return res;
	}
	
	
	
	
	
	
	
	
	
	
	
}
